<template>
  <div>
    <el-card class="box-card" shadow="hover">
      <div slot="header" class="clearfix">
        <span>招标项目信息</span>
      </div>
      <el-form label-width="200px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="项目名称">
              11133sss
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="项目编号">
              11111
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开启倒计时">
              审批通过
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开启一览表">
              dddfddd
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>

    <el-card class="box-card" shadow="hover" style="margin-top: 10px">
      <div slot="header" class="clearfix">
        <span>解密标段（包）信息<span style="color: red;">（下列表格显示内容为：没有流标邀项的标段（包））</span></span>
      </div>
      <el-table
        :data="saleFileList"
        size="mini"
        style="width: 100%;">
        <el-table-column
          prop="budget"
          header-align="center"
          align="center"
          label="序号">
        </el-table-column>
        <el-table-column
          prop="fileName"
          header-align="center"
          align="center"
          label="标段（包）编号">
        </el-table-column>
        <el-table-column
          prop="fileName"
          header-align="center"
          align="center"
          label="标段（包）名称">
        </el-table-column>
        <el-table-column
          prop="filePrice"
          header-align="center"
          align="center"
          label="资格预审申请数量">
          <template slot-scope="scope">
            {{scope.row.filePrice}}
          </template>
        </el-table-column>
        <el-table-column
          prop="budget"
          header-align="center"
          align="center"
          label="资格预审申请文件递交截止时间">
        </el-table-column>
        <el-table-column
          prop="budget"
          header-align="center"
          align="center"
          label="状态">
        </el-table-column>
        <el-table-column
          prop="budget"
          header-align="center"
          align="center"
          label="备注">
        </el-table-column>
        <el-table-column
          fixed="right"
          header-align="center"
          align="center"
          width="120"
          label="操作">
          <template slot-scope="scope">
            <el-button type="text" size="small">修改</el-button>
            <el-button type="text" size="small">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>

    <el-card class="box-card" shadow="hover" style="margin-top: 10px">
      <div slot="header" class="clearfix">
        <span>解密标段（包）详情</span>
      </div>
      <span>标段（包）编号：Iss-6606/01 标段（包）名称：预审后审全网上流程-Iss-201706112</span>
      <el-table
        :data="saleFileList"
        size="mini"
        style="width: 100%;">
        <el-table-column
          prop="budget"
          header-align="center"
          align="center"
          label="序号">
        </el-table-column>
        <el-table-column
          prop="fileName"
          header-align="center"
          align="center"
          label="供应商名称">
        </el-table-column>
        <el-table-column
          prop="fileName"
          header-align="center"
          align="center"
          label="解密文件">
        </el-table-column>
        <el-table-column
          prop="filePrice"
          header-align="center"
          align="center"
          label="签到标记">
          <template slot-scope="scope">
            {{scope.row.filePrice}}
          </template>
        </el-table-column>
        <el-table-column
          prop="budget"
          header-align="center"
          align="center"
          label="解密标记">
        </el-table-column>
        <el-table-column
          prop="budget"
          header-align="center"
          align="center"
          label="签名标记">
        </el-table-column>

        <el-table-column
          fixed="right"
          header-align="center"
          align="center"
          width="120"
          label="操作">
          <template slot-scope="scope">
            <el-button type="text" size="small">修改</el-button>
            <el-button type="text" size="small">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>

    <div style="text-align: center; padding: 10px; margin-top: 20px">
      <el-button size="small" type="primary">生成开启一览表</el-button>
      <el-button size="small" type="primary">开启结束</el-button>
      <el-button size="small" @click="$router.go(-1)">返回</el-button>
    </div>
  </div>
</template>

<script>
  import ueditor from 'ueditor'

  export default {
    data () {
      return {
        ue: null,
        ueId: `J_ueditorBox_${new Date().getTime()}`,
        ueContent: '',
        visible: false,
        checkList: [],
        saleFileList: [{
          id: 1,
          filePrice: 200,
          surePrice: 20000,
          techPrice: 10000,
          budget: '1标段'
        }],
        dataForm: {
          id: 0
        },
        dataRule: {
        }
      }
    },
    mounted () {
      this.ue = ueditor.getEditor(this.ueId, {
        // serverUrl: '', // 服务器统一请求接口路径
        zIndex: 3000
      })
    },
    methods: {
      init (id) {
        this.dataForm.id = id || 0
        this.visible = true
        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields()
          if (this.dataForm.id) {
            this.$http({
              url: this.$http.adornUrl(`/bid/project/info/${this.dataForm.id}`),
              method: 'get',
              params: this.$http.adornParams()
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.dataForm.projectCode = data.project.projectCode
                this.dataForm.projectName = data.project.projectName
                this.dataForm.tradeTypeId = data.project.tradeTypeId
                this.dataForm.tradeTypeName = data.project.tradeTypeName
                this.dataForm.projectTypeOneId = data.project.projectTypeOneId
                this.dataForm.projectTypeOneName = data.project.projectTypeOneName
                this.dataForm.projectTypeTwoId = data.project.projectTypeTwoId
                this.dataForm.projectTypeTwoName = data.project.projectTypeTwoName
                this.dataForm.entrustId = data.project.entrustId
                this.dataForm.contractId = data.project.contractId
                this.dataForm.projectManagerId = data.project.projectManagerId
                this.dataForm.projectManager = data.project.projectManager
                this.dataForm.feeServer = data.project.feeServer
                this.dataForm.feeMethod = data.project.feeMethod
                this.dataForm.projectBlock = data.project.projectBlock
                this.dataForm.supervision = data.project.supervision
                this.dataForm.feeSourceId = data.project.feeSourceId
                this.dataForm.feeSource = data.project.feeSource
                this.dataForm.needPurchase = data.project.needPurchase
                this.dataForm.budget = data.project.budget
                this.dataForm.scheduleId = data.project.scheduleId
                this.dataForm.scheduleName = data.project.scheduleName
                this.dataForm.tendereeId = data.project.tendereeId
                this.dataForm.tendereeName = data.project.tendereeName
                this.dataForm.bidScope = data.project.bidScope
                this.dataForm.bidContent = data.project.bidContent
                this.dataForm.province = data.project.province
                this.dataForm.city = data.project.city
                this.dataForm.bidMethod = data.project.bidMethod
                this.dataForm.openMethod = data.project.openMethod
                this.dataForm.openStep = data.project.openStep
                this.dataForm.needApprove = data.project.needApprove
                this.dataForm.approveMethod = data.project.approveMethod
                this.dataForm.evaluateMethod = data.project.evaluateMethod
                this.dataForm.submitMethod = data.project.submitMethod
                this.dataForm.remark = data.project.remark
                this.dataForm.createOn = data.project.createOn
                this.dataForm.createUserId = data.project.createUserId
                this.dataForm.createBy = data.project.createBy
                this.dataForm.modifiedOn = data.project.modifiedOn
                this.dataForm.modifiedUserId = data.project.modifiedUserId
                this.dataForm.modifiedBy = data.project.modifiedBy
              }
            })
          }
        })
      },
      // 表单提交
      dataFormSubmit () {
        this.$refs['dataForm'].validate((valid) => {
          if (valid) {
            this.$http({
              url: this.$http.adornUrl(`/bid/project/${!this.dataForm.id ? 'save' : 'update'}`),
              method: 'post',
              data: this.$http.adornData({
                'id': this.dataForm.id || undefined,
                'projectCode': this.dataForm.projectCode,
                'projectName': this.dataForm.projectName,
                'tradeTypeId': this.dataForm.tradeTypeId,
                'tradeTypeName': this.dataForm.tradeTypeName,
                'projectTypeOneId': this.dataForm.projectTypeOneId,
                'projectTypeOneName': this.dataForm.projectTypeOneName,
                'projectTypeTwoId': this.dataForm.projectTypeTwoId,
                'projectTypeTwoName': this.dataForm.projectTypeTwoName,
                'entrustId': this.dataForm.entrustId,
                'contractId': this.dataForm.contractId,
                'projectManagerId': this.dataForm.projectManagerId,
                'projectManager': this.dataForm.projectManager,
                'feeServer': this.dataForm.feeServer,
                'feeMethod': this.dataForm.feeMethod,
                'projectBlock': this.dataForm.projectBlock,
                'supervision': this.dataForm.supervision,
                'feeSourceId': this.dataForm.feeSourceId,
                'feeSource': this.dataForm.feeSource,
                'needPurchase': this.dataForm.needPurchase,
                'budget': this.dataForm.budget,
                'scheduleId': this.dataForm.scheduleId,
                'scheduleName': this.dataForm.scheduleName,
                'tendereeId': this.dataForm.tendereeId,
                'tendereeName': this.dataForm.tendereeName,
                'bidScope': this.dataForm.bidScope,
                'bidContent': this.dataForm.bidContent,
                'province': this.dataForm.province,
                'city': this.dataForm.city,
                'bidMethod': this.dataForm.bidMethod,
                'openMethod': this.dataForm.openMethod,
                'openStep': this.dataForm.openStep,
                'needApprove': this.dataForm.needApprove,
                'approveMethod': this.dataForm.approveMethod,
                'evaluateMethod': this.dataForm.evaluateMethod,
                'submitMethod': this.dataForm.submitMethod,
                'remark': this.dataForm.remark,
                'createOn': this.dataForm.createOn,
                'createUserId': this.dataForm.createUserId,
                'createBy': this.dataForm.createBy,
                'modifiedOn': this.dataForm.modifiedOn,
                'modifiedUserId': this.dataForm.modifiedUserId,
                'modifiedBy': this.dataForm.modifiedBy
              })
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.$message({
                  message: '操作成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                    this.visible = false
                    this.$emit('refreshDataList')
                  }
                })
              } else {
                this.$message.error(data.msg)
              }
            })
          }
        })
      },
      getContent () {
        this.dialogVisible = true
        this.ue.ready(() => {
          this.ueContent = this.ue.getContent()
        })
      }
    }
  }
</script>
